Show Hidden Files in Mac OS X

Feb 25, 2009 - 48 Comments

Finder Need to show hidden files on a Mac? This is pretty common if you find yourself needing to access hidden files on your Mac, like an .htaccess file you downloaded, a .bash_profile, a .svn directory, – literally anything preceded with a ‘.’ indicating it is invisible by default – you can run the below command from the terminal to set hidden files to become visible throughout Mac OS X.

For some quick background to fill in those who don’t know, files that are hidden in Mac OS are determined so by preceding the filename with a single period symbol (.), you can actually make any file hidden by placing a period in front of the name, thus making it invisible to the Finder. Let’s walk through making all hidden files become visible in Mac OS X, regardless of what system software version is on the Mac.

How to Show Hidden Files & Folders on Mac

This changes the default setting of Mac OS X so that Finder always shows all files, including showing hidden files.

  1. Launch the Terminal app, found in /Applications/Utilities
  2. Enter the proper command exactly as shown below, choosing for your version of MacOS or Mac OS X:
  3. For showing hidden files and folders in macOS High Sierra 10.13, MacOS Sierra 10.12, OS X El Capitan 10.11, Yosemite 10.10, and OS X Mavericks 10.9, use the following command string to show hidden files:

    defaults write com.apple.finder AppleShowAllFiles TRUE;killall Finder

    For showing hidden files in Mac OS X 10.8 Mountain Lion, OS X 10.7 Lion, Mac OS X 10.6 Snow Leopard, and before, use this defaults command string instead:

    defaults write com.apple.Finder AppleShowAllFiles TRUE;killall Finder

  4. Hit the Return key after the command is entered into the Terminal command prompt, that will execute the command and allow the hidden files to become visible in the file system of Mac OS

Here is what the defaults command string which shows hidden files looks like in the Mac Terminal:

Show Hidden Files on Mac with defaults command string at Terminal

The Finder will refresh after you hit the Return key, which causes Finder to quit and relaunch itself for the changes to take effect, thus revealing hidden files on the Mac.

“Hidden” files are now visible in Finder windows, but they will display as a dimmed version of their respective file icons, being slightly transparent. Examples of how hidden files show up in the Finder are shown below.

This is how hidden files look when they’re visible in a modern version of Mac, like an macOS High Sierra, Sierra, OS X El Capitan or Yosemite Finder window, note the hidden folders and files are visible but have dimmed gray names:

Hidden files visible in Mac OS X Finder

And this is how the once invisible files show in prior releases of Mac OS X, highlighted here:

Hidden files shown in Mac OS X

This setting stays in place until it has been reversed or disabled, which would cause all files to become hidden again just as the default. With all the files visible a Finder window can look much busier than you may be accustomed to, and it’s not always desired to leave on constantly. Thankfully it’s just as easy to switch back.

Finder icon

Remember the Finder must relaunch to show hidden files and folders, they will appear as slightly translucent icons alongside the normal icons. The files and folders that are hidden typically will have a ‘.’ in front of their name, but other items can be hidden as well through chflags commands.

If you’re having difficulty with the above commands for some reason, you can split them up into two parts like so:

First the command to show invisible files on Mac:

defaults write com.apple.finder AppleShowAllFiles TRUE

Then the command to kill and relaunch Finder on Mac, which is where the invisible files will now be shown:

killall Finder

Note that refreshing Finder is always necessary. This is the same in OS X El Capitan, Yosemite and old versions of Mac OS X too, the Finder must always be refreshed this way to reveal the hidden folders and files.

* Quick note about different versions of Mac OS X: If you look carefully, you’ll notice there is a very slight difference in casing for making hidden files and folders visible in modern versions of macOS and Mac OS X versus older versions of Mac OS X system software (com.apple.finder vs com.apple.Finder). That casing is important, however, which is why you must enter exact syntax.

Reverse to Default & Make Files Hidden Again in Mac OS X

To hide files that are intended to be hidden again, thus going back to the default Mac settings of keeping them invisible, you can just type the following defaults command. As you can see, everything is the same except that TRUE has been switched to “FALSE”:

defaults write com.apple.Finder AppleShowAllFiles FALSE;killall Finder

Remember the slight difference in OS X Mavericks, El Capitan, and Yosemite has to do with capitalization:

defaults write com.apple.finder AppleShowAllFiles FALSE;killall Finder

Hit return, and again the command will set the file visibility change and relaunch Finder so that it can relaunch for changes to take effect.

That’s all there is to it! The change will revert and you’ll be back to the default with hidden folders and files no longer visible in the Mac OS X Finder.

Show Hidden Files in a Mac Open or Save Dialogue Temporarily

Another approach to without using the above defaults command is to quickly show all hidden files in any Mac OS X Open or Save dialogue box by hitting Command+Shift+Period on the keyboard together. You will instantly see the change as once-hidden files are revealed.

show hidden files mac That command sequence can be used to toggle back or forth, thereby revealing and hiding the files again as needed. For many users, this keystroke is the most appropriate use for when an invisible file must be modified but there is no need to make them all visible all the time.

Show Hidden Files & Folders on a Mac Temporarily with Terminal

Another way to quickly see hidden files in OS X is by using the ls command within the Terminal, at the command line type the following:

ls -a

The -a flag tells the ls (list) command to show all contents, including hidden files. You then just have to specify a directory if you want to see the hidden files in it:

ls -a ~/Sites/betasite

This method does not effect the Finder or the visibility of hidden files outside of using the -a flag, making it a temporary measure to quickly see all contents of any directory or folder, even if the above defaults command isn’t used.

One way to carry over the terminal to the GUI though would be to use the ‘open’ command, directed at a hidden file. Here’s an example:

open .not_visible_by_default

show hidden files mac This will launch the file called “.not_visible_by_default” into the default GUI app associated with it’s file type, in this case it would be a text file and so TextEdit would open. This trick can also be used to open hidden directories into the Finder, for example with the following syntax:

open ~/.git

That would launch the hidden “.git” directory in a users home directory into a Finder window, without revealing all other files.

.

Related articles:

Posted by: Paul Horowitz in Command Line, Mac OS, Tips & Tricks

48 Comments

» Comments RSS Feed

  1. Lyle says:

    Well, thanks! I have to look this up every time I install on a new disk. Maybe I’ll create an AppleScript for it this time…

  2. Braedyn says:

    Thanks

  3. How do I find this route?
    file:///private/tmp/project

    • Paul says:

      That would be starting at the root directory of your Mac, the true directory path is:

      /private/tmp/project

      If you use the Go To Folder command in the Finder you can easily get there. From the Finder, pull down the “Go” menu and choose ‘Go To Folder’ then enter the path you specified as /private/tmp/project/

      Keep in mind you should never manually delete or modify anything in the /tmp or /private folders, or anything else at the root / level of a computer!

      More about Go To Folder here

      https://osxdaily.com/2011/08/31/go-to-folder-useful-mac-os-x-keyboard-shortcut/

  4. Gene Miller says:

    NOTE: shift+command+period toggles hidden files in Finder list view as well!! (on macOS Sierra Ver 10.12.4)

  5. following ALEXA’s instructions (7/25/16) on … received the following Message from “Save …”, RUN, and Hammer icons:

    Expected “given”, “in”, “of”, expression, “with”, “without”, other parameter name, etc. but found unknown token.

    the only difference i see is the pasted script in the Apple Script Editor, there are no blank lines.

    ??

    i’m using Sierra 10.12.3, on a 3.4 Ghz core I5, everything’s up to date, less OneDrive and Twitter

  6. kontrol says:

    my 3 tb airport extreme does not have such a folder (hidden or otherwise), mac os seirra.
    ?

  7. Great says:

    Great tip, using this to show hidden files in macOS Sierra. Works exactly as described.

    Thanks.

  8. ALEXA says:

    Using Terminal to show hidden files on Mac killed me every time. I`ve created script files for these commands so it saves my time.
    Open Script Editor, paste to the window the following instructions:

    set vis to do shell script “defaults read com.apple.Finder AppleShowAllFiles”
    if vis = “0” then
    do shell script “defaults write com.apple.Finder AppleShowAllFiles 1”
    else
    do shell script “defaults write com.apple.Finder AppleShowAllFiles 0”
    end if
    tell application “Finder” to quit
    delay 1
    tell application “Finder” to activate

    Save the file and then just run it to change files visibility.

  9. jos. says:

    More easily understood than the directions on the MAC support pages. Greatly appreciated!!

  10. Glauco Zega says:

    Thank you so much!

  11. Pristique says:

    LOL giving advice to trust third party apps trust that require sudo privileges on OS X is silly. That is probably the single easier way to completely compromise the security of your entire system.

    • clueless says:

      What are you even talking about? This is showing how to display hidden files by using defaults commands. All defaults commands are part of OS X system modification, they are not third party and there is no requirements to use any third party anything to make hidden files visible on a Mac.

    • motti Shneor says:

      Have you at all read and tried the method described? ‘defaults’ command line is not only Apple-made, it’s also a core component of the OS. No 3rd party here. Furthermore – there’s no need for ‘sudo’ here or any privilege lifting whatsoever. The commands presented here work for every users, affect ONLY the current user issuing the commend, and work perfectly for non-admin and even guest uses. This is a visual preference thing! There is no secret about it (Feature publishes by Apple) and I think you had to say that thing no matter the context… Everything presented here is perfectly legit, and benign too.

  12. Chris Viljoen says:

    Thanks for the article!

    It’s free and works well if anyone else stumbles onto this thread.

  13. kizi says:

    i did it but can’t see file (.htaccess) yet? can anyone help

  14. Martin says:

    Command+Shift+. on Mavericks doesn’t work well in column-view mode. Have to click in and our of folders. Not reliable. Works well in list view though.
    Great tip! Used OSX for years without knowing that shortcut…

  15. NH says:

    I have a question… I saw a .dsstore and .local file on the desktop that I assume were copied there from my FTP by mistake.. after I fixed the file that was wrongly marked with the dot, is it safe to trash those ?

  16. R says:

    Thank you……. this info is really helpful !

  17. Sam says:

    On some versions of the operating system, it requires a YES to enable, and a NO to disable, instead of TRUE or FALSE.

    It will not give you any feedback if successful.

    Do a killall Finder to see the change.

  18. eric says:

    Whether this is old news or not, I didn’t know it, and I just tried it, and it worked. That is great. Thank you.

  19. Frank says:

    Thank you! Was in a pickle and really needed to see my hidden files. This command worked great.

  20. rebecca says:

    ok, this may seem ridiculous but a bit of an amateur here, how do you access the terminal to type commands in? Am on a macbook running OS X 10.5.8

    thanks.

  21. Mohammed EL ASSAL says:

    Thank you so much for your contribution !!

  22. Nick says:

    I tried to hide the hidden files again but it wont work

    • Motti Shneor says:

      I thought it didn’t work for me at times… then I saw I was looking at a folder that had no hidden files – hence no visible change was evident. Do this in your home folder, or somewhere you KNOW contains hidden files.

  23. Diyer says:

    You can also you kill all on the same command line. Check out this for an example.

    defaults write com.apple.finder AppleShowAllFiles TRUE;killall Finder

  24. Don says:

    Just what I was looking for. Thanks.

  25. JohnUlmer says:

    Here’s another way:
    To show hidden files, Start Property List Editor, then with it open the file /Users/Library/Preferences/com.apple.finder.plist. Look for the key named “AppleShowAllFiles”, and change its value to TRUE. Type Command-S to save the edit. Then restart the finder, either with `killall Finder` in Terminal or by re-launching Finder in the Force-Quit Applications app (Command-Option-Esc).

    In my case I must add that Property List Editor made it obvious to me that I had recently fat-fingered this task at the command-line: there was a Key in the plist named “ApplwShowAllFiles”. Oops.

  26. radarak says:

    what about ~/private/var/vm ?!
    this is the folder for creating huge snapshots of os which changes alot.

  27. Arvid Nielsen says:

    Great help – thanks man!

    Any of you guys want to keep that particular folder or file at hand, after having hidden files again, without having to do the whole Terminal thing? (To me it’s quite scary to mess with the system like that, anyway.):

    Drop the folder or file onto the sidebar of your Finder window. Now, you should be able to access it, directly and easily, in the future.

  28. Anthony says:

    Thanks a ton! I’ve been using Houdini to reveal the .htaccess files so far but it’s far more convenient to have hidden files revealed by default.

  29. Paul says:

    Need to turn it on an off? I use it when working on volumes on a Mac OS X Server or other Unix boxes, typically for .htaccess files. I only need it on occasionally and don’t want the clutter or risk otherwise.

    So using a plain text editor create two simple files with the commands to turn on and off. (TextEdit won’t do, but Word will save in plain text)

    Make them executable with chmod thru Terminal. Use Finder’s Get Info to set them to open with Terminal

    From then on you can double-click it to switch between showing and hiding.

  30. DD says:

    Sooo simple! though I’ve been a Mac user since 1987 I’ve never needed to hide a file. Now I do and I did in a few seconds. Thanxxxx

  31. macbeth says:

    Oh, please don’t be a crybaby ac_poster, MacOsXHints don’t owe hints and tips, they’re available for anyone – not copyrighted or nothing, so stop your whining and be happy for new Mac Users. Old ancient news you say, for whom? Those who have known for a while? For newbies it is News. – Instead consider this: Try search the internet for ‘show hidden files 10.6′. The first two hits are open/save dialogues, the third hit is this page. Instead try improving macosxhints’ GUI, it is not User Friendly when you find your tip in the comments below (jantonc)..

  32. bjs1990peregrine says:

    Tnomeralc, I’ve found an easy way to hide folders without buying an application. First, use the command listed above to show hidden files. Then, rename the folder you’d like to hide by adding a dot (.) at the beginning of the name. For example, “MyFolder” would become “.MyFolder”
    After that, hide the folders again and you’re all set!

    Hope that helps!

  33. Atari Dude says:

    Thanks, I used to use a third party app for doing this but I find it easy to use the Terminal command.

    defaults write com.apple.finder AppleShowAllFiles TRUE;killall Finder

    That worked for me, all invisible files are now visible.

  34. YourT says:

    Instead of YES it Should be TRUE

  35. ac_poster says:

    or you could type in that command into the terminal which is far easier…. and also… this is old news how to do this in mac os x… old ancient news…

    • derpy says:

      or you could just not leave an unnecessary comment and stop being a self-righteous macsnob…and also…you’re lame…and also…this is an old ancient post… and also… your mom

      • Dick.Zombi says:

        Terminal comes with your Mac… No download required.
        Post = Necessary.
        It’s funny to see the self-righteous of one bash the self-righteous of another. Go Linux.

    • Bruce says:

      Old, old, old news that, to this day, is still important because Apple doesn’t think its users need obvious ways to see hidden files. When software is written in a way that seems to imply that it knows better than its users what should be allowed (e.g. seeing “invisible files”), then the software writers are both arrogant and wrong.

      • Bob says:

        You have obviously never seen my mom use a computer. It is arrogant to assume that everyone has the same ability to understand tech that you do.

  36. Paul says:

    There is a simple app you can install to do this, called “Blind” Check it out here: http://www.macupdate.com/info.php/id/22495/blind

Leave a Reply

 

Shop on Amazon.com and help support OSXDaily!

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates

Tips & Tricks

News

iPhone / iPad

Mac

Troubleshooting

Shop on Amazon to help support this site